package com.cosina.game.crystallight.model.crystal;

import com.cosina.game.crystallight.data.CrystalInfo;
import com.cosina.game.crystallight.engine.util.Time;

public class Crystal implements Time{
	public int level;
	public final int color;;
	public Weapon weapon;
	public Crystal(int color,int level){
		this.color = color;
		this.level = level;
		this.weapon = new Weapon(this,CrystalInfo.startAttack[color][level]);
	}
	
	public void doMixture(Crystal plamStuff) {
		if(this.level == plamStuff.level && this.level != CrystalInfo.MAX_LEVEL){
			this.level ++;
			weapon.attack = (int)((this.weapon.attack + plamStuff.weapon.attack)* 0.83f);
		}else if(this.level > plamStuff.level){
			this.weapon.attack = (int)(plamStuff.weapon.attack*(0.83f -0.2f*(this.level - plamStuff.level)) + this.weapon.attack * 0.83f);
		}else{
			this.weapon.attack = plamStuff.level;
			this.weapon.attack = (int)(this.weapon.attack*(0.83f -0.15f*(plamStuff.level - this.level)) + plamStuff.weapon.attack * 0.83f);
		}
	}
	
	public int rangeLevel;
	public int speedLevel;
	
	@Override
	public void withTimeGo() {
		weapon.tryReload();
	}
}
